Skip to content

Contact Form

Next we'll build the contact form. There is a requirement for a relationship between an 'organisation' and a 'contact'.
We'll use the organisation template as a foundation to build the contact form, and we'll add a new component - sc-related-document

Note the use of 'fieldDefault' used to bring additional data from the related document.

{
    "systemHeader": {
        "systemType": "template",
        "templateId": "74746c80-8378-11e6-99b1-71ee944cf59f",
        "summaryName": "Contact Template"
    },
    "summaryNameRule": "Contact: {{{contactName.firstName}}} {{{contactName.surname}}}",
    "formColor": "#f3f3f3",
    "appTags": [
        "myApplication",
        "contact"
    ],
    "components": [
        {
            "componentName": "sc-static-html",
            "label": "Contact Details",
            "name": "panel1",
            "fullWidth": true,
            "wrapClass": "panel-primary",
            "wrapAction": "open",
            "wrapHtmlType": "wrap"
        },
        {
            "componentName": "sc-party",
            "name": "contactName",
            "label": "Contact Name",
            "mandatory": true,
            "fullWidth": true
        },
        {
            "componentName": "sc-phone-number",
            "name": "phone",
            "label": "Phone Number"
        },
        {
            "componentName": "sc-email",
            "name": "email",
            "label": "Email Address"
        },
        {
            "componentName": "sc-related-document",
            "name": "orgRel",
            "showDropDown": true,
            "filter": "{'query':{'bool':{'filter':[{'term':{'systemHeader.systemType': 'document'}},{'term':{'appTags':'organisation'}},{'term':{'appTags':'myApplication'}}]}}}",
            "fieldDefault": {
                "addressGeo": "addressGeo"
            },
            "label": "Organisation",
            "newTemplate": "53bd7810-bad0-11e8-9c0c-e3ee36fd7cf7"
        },
        {
            "componentName": "sc-static-html",
            "name": "panel1",
            "wrapHtmlType": "wrap",
            "wrapAction": "close"
        },
        {
            "componentName": "sc-static-value",
            "name": "appTags",
            "value": [
                "myApplication",
                "contact"
            ],
            "visible": false
        }
    ]
}